﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using BioBooking.Data;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows;

namespace BioBooking.Client.ValueConverters
{
    public class SeatStateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            SeatState state = value as SeatState;
            if (state == null)
                return null;

            SolidColorBrush brush = new SolidColorBrush();

            if (state.Occupied)
            {
                brush.Color = Color.FromRgb(172, 0,0);
            }
            else if (state.Locked)
            {
                brush.Color = Color.FromRgb(214, 65, 0);
            }
            else if(!state.Occupied)
            {
                brush.Color = Color.FromRgb(0, 172, 0);
            }

            return brush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            //SolidColorBrush brush = value as SolidColorBrush;

            //if (brush.Color == Colors.Red)
            //{
            //    return false;
            //}
            //else if (brush.Color == Colors.Green)
            //{
            //    return true;
            //}

            //return false;
            return DependencyProperty.UnsetValue;
        }
    }
}
